package common;

import common.lifecycle.Closeable;
import common.listener.Subscriber;

//事件发布者
public interface EventPublisher extends Closeable {

    //初始化
    void init(Class<? extends Event> type, int bufferSize);

    long currentEventSize();

    //添加订阅者
    void addSubscriber(Subscriber subscriber);

    //取消订阅者
    void removeSubscriber(Subscriber subscriber);

    //发布事件
    boolean publish(Event event);

    //发布后通知事件
    void notifySubscriber(Subscriber subscriber, Event event);
}
